<template>
    <div class="scan">

    </div>
</template>

<script>
    import Wx from '@/wx'
    import {sign} from "../../api/wx";
    import {scan} from "../../api/course";
    import * as Dialog from '@/dialog'
    export default {
        name: "index",
        activated() {
            let url = process.env.VUE_APP_PATH + Wx.getPath()
            sign(url).then(res => {
                Wx.config(res.data).then(()=>{
                    Wx.scan().then(res=>{
                        if(res==='cancel'){
                            this.$router.back()
                        }else {
                            scan(res).then(res=>{
                                Dialog.showCorrect().then(()=>{
                                    this.$router.back()
                                })
                            })
                        }
                    })
                })
            })
        }
    }
</script>

<style scoped lang="stylus">

</style>